import logging
from appium.webdriver.common.appiumby import By
import sys
sys.path.append('..')
from time import sleep
from base_view.base_page import BasePage
from common.desired_caps import desired_caps

class Common(BasePage):
    cancel_loc = (By.ID, 'android:id/button2')
    skip_loc = (By.ID, 'com.tal.kaoyan:id/tv_skip')

    def __init__(self, driver):
        super().__init__(driver)
    def check_cancel(self):
        try:
            self.find_ele(self.cancel_loc)
        except:
            logging.info('no cancelBtn')
        else:
            self.ele.click(self.cancel_loc)
    def check_skip(self):
        try:
            self.find_ele(self.skip_loc)
        except:
            logging.info('no skipBtn')
        else:
            self.ele.click(self.skip_loc)

if __name__ == '__main__':
    driver = desired_caps()
    common = Common(driver)
    common.check_cancel()
    common.check_skip()
    sleep(3)
    driver.quit()
